package com.zzu.base.controller.file;

import com.zzu.base.service.ResourceDownloadService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/file")
@Tag(name = "文件下载")
@PreAuthorize("hasPermission(null,'restricted_use')")
public class FileController {
    @Resource
    ResourceDownloadService resourceDownloadService;
    @GetMapping("/download")
    public void download(String relativePath, HttpServletResponse response) {
        resourceDownloadService.downloadByRelativePath(relativePath, response);
    }
}
